package cn.wolfcode.service;

import cn.wolfcode.domain.OperateIntergralVo;
import io.seata.rm.tcc.api.BusinessActionContext;
import io.seata.rm.tcc.api.BusinessActionContextParameter;
import io.seata.rm.tcc.api.LocalTCC;
import io.seata.rm.tcc.api.TwoPhaseBusinessAction;

@LocalTCC
public interface IUsableIntegralService {
    void descIntergral(OperateIntergralVo operateIntergralVo);
    void incrIntergral(OperateIntergralVo operateIntergralVo);

    /**
     * 减少积分
     */
    @TwoPhaseBusinessAction(
            name = "decrIntergralTry",
            commitMethod = "decrIntergralCommit",
            rollbackMethod = "decrIntergralRollback")
    /**
     * 把当前参数放到上下文中
     */
    void decrIntergralTry(@BusinessActionContextParameter(paramName = "operateIntergralVo1") OperateIntergralVo operateIntergralVo, BusinessActionContext context);

    void decrIntergralCommit(BusinessActionContext context);

    void decrIntergralRollback(BusinessActionContext context);



    /**
     * 增加积分
     */
    @TwoPhaseBusinessAction(
            name = "incrIntergralTry",
            commitMethod = "incrIntergralCommit",
            rollbackMethod = "incrIntergralRollback")
    /**
     * 把当前参数放到上下文中
     */
    void incrIntergralTry(@BusinessActionContextParameter(paramName = "operateIntergralVo") OperateIntergralVo operateIntergralVo, BusinessActionContext context);

    void incrIntergralCommit(BusinessActionContext context);

    void incrIntergralRollback(BusinessActionContext context);

}
